﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace QTMusic.UserControls
{
    public partial class RightMenuBar : System.Web.UI.UserControl
    {

        override protected void OnInit(EventArgs e)
        {
            Panel1.Controls.Clear();
            HttpCookie cookie = Request.Cookies["QTCookie"];
            if (cookie != null && cookie["Name"] != null && cookie["ID"] != null)
            {
                // if a user have logged in:
                // Show 4 button
                Control buttons = LoadControl("../UserControls/ControlButtons.ascx");
                Panel1.Controls.Add(buttons); 
            }
            else
            {
                // if no user logged in yet:
                // Create Login panel
                Control loginpanel = LoadControl("../UserControls/LoginPanel.ascx");
                Panel1.Controls.Add(loginpanel);
            }
        }

        protected void Page_Load(object sender, EventArgs e)
        {

        }
    }
}